'use strict'

const crypto = require('crypto')

module.exports = {
    async promisify(fn, receiver) {
        return (...args) => {
            return new Promise((resolve, reject) => {
                fn.apply(receiver, [...args, (err, res) => {
                    return err ? reject(err) : resolve(res)
                }])
            })
        }
    },
    md5(param) {
        return crypto.createHash('md5').update(param).digest('hex')
    },
    fetch() {
        return {
            host: '47.93.206.198',
            port: '3306',
            user: 'root',
            password: 'www_unmcc_com',
            database: 'vr_show'
        }
    },
    fetchWuye() {
        return {
            host: '47.93.206.198',
            port: '3306',
            user: 'root',
            password: 'www_unmcc_com',
            database: 'property'
        }
    }
}